<div id="tab7" class="tab">
    <div class="tab-labels">
        <div class="xian"></div>
        三者财务损失
    </div>
    <div id="div6">
        <div style="border:1px solid #FF5722; padding-top: 10px;">
            <form action="" method="post" id="szwusun_forms">
                <table class="layui-table" id="tabProduct666">
                    <tr style="background:#4e73df;color: #fff;" class="ys">
                        <td style="width: 66px;">选择</td>
                        <td>序号</td>
                        <td>财物名称</td>
                        <td>价格方案</td>
                        <td>价格</td>
                        <td>核定价格</td>
                        <td>备注</td>
                    </tr>
                    {empty name="scwusun"}
                    <tr>
                        <td><input type="checkbox" style="width: 15px;height: 15px;display: block;" name="id"
                                   class="cid666" value=""></td>
                        <td><input type="text" name="xuhao" class="xuhao666" readonly value="1"></td>

                        <td><input type="text" readonly name="name" class="name666"></td>
                        <td><input type="text" readonly name="fangan" class="fangan666" list="peijians">
                            <datalist id="peijians">
                                <option value="4S店维修">4S店维修</option>
                                <option value="一类修理厂">一类修理厂</option>
                                <option value="二类修理厂">二类修理厂</option>
                                <option value="三类修理厂">三类修理厂</option>
                            </datalist>
                        </td>
                        <td><input type="text" readonly name="price" class="price666" oninput="va6()"></td>
                        <td><input type="text" readonly name="num" class="num666" oninput="va6()"></td>
                        <td><input type="text" readonly name="money" class="money666" oninput="va6()"></td>
                        <td><input type="text" readonly name="price_he" class="price_he" oninput="va6()"></td>
                        <td><input type="text" readonly name="num_he" class="num_he" oninput="va6()"></td>

                        <td><input type="text" readonly name="hejia" class="hejia666" oninput="va6()"></td>
                        <td><input type="text" readonly name="beizhu" class="beizhu666"></td>
                    </tr>
                    {/empty}
                    {volist name="scwusun" id="sanchess_wu"}
                    <tr>
                        <td><input id="sancai_id_{$sanchess_wu.id}" type="checkbox"
                                   style="width: 15px;height: 15px;display: block;" name="id" class="cid666"
                                   value="{$sanchess_wu.id}"></td>
                        <td><input id="sancai_xuhao_{$sanchess_wu.id}" type="text" name="xuhao" readonly
                                   class="xuhao666" value="{$sanchess_wu.xuhao}"></td>
                        <td><input id="sancai_name_{$sanchess_wu.id}" onclick="openDialogs666(this)"
                                   style="text-decoration: underline;color:blue;cursor: pointer;" type="text" readonly
                                   name="name" class="name666" value="{$sanchess_wu.name}"></td>
                        <td><input id="sancai_fangan_{$sanchess_wu.id}" type="text" readonly name="fangan"
                                   class="fangan666" list="bencai" value="{$sanchess_wu.fangan}">
                            <datalist id="bencai">
                                <option value="4S店维修">4S店维修</option>
                                <option value="一类修理厂">一类修理厂</option>
                                <option value="二类修理厂">二类修理厂</option>
                                <option value="三类修理厂">三类修理厂</option>
                            </datalist>
                        </td>
                        <td><input id="sancai_price_{$sanchess_wu.id}" type="text" readonly name="price"
                                   class="price666" value="{$sanchess_wu.c_zongji}" oninput="va6()"></td>
                        <td><input id="sancai_money_{$sanchess_wu.id}" type="text" readonly name="money"
                                   class="money666" value="{$sanchess_wu.hd_c_zongji}" oninput="va6()"></td>
                        <td><input type="text" readonly name="beizhu" class="beizhu666" value="{$sanchess_wu.beizhu}">
                        </td>
                    </tr>
                    {/volist}
                </table>
                <hr>
        </div>
        </form>
    </div>
    <div id="light666" class="white_content">
        <div class="content">
            <!--三者车-->
            <div>
                <form action="" id="sanwu_form">
                    <input type="hidden" name="id" value="{$row.id}">
                    <input type="hidden" name="bid" class="bid" value="">
                    <div class="titles">
                        <p><font></font>三者财物定损</p>
                    </div>
                    <!--            <form action="">-->
                    <table class="layui-table" id="tabProduct46">
                        <tr style="background:#4e73df;color: #fff;" class="ys">
                            <td style="width: 66px;">选择</td>
                            <td>序号</td>
                            <td>服务种类</td>
                            <td>财物名称</td>
                            <td>价格方案</td>
                            <td>价格</td>
                            <td>数量</td>
                            <td>金额</td>
                            <!-- <td>折扣</td> -->
                            <td>核定价格</td>
                            <td>核定数量</td>
                            <td>核价金额</td>
                            <td>备注</td>
                        </tr>
                        <tr>
                            <td><input type="checkbox" style="width: 15px;height: 15px;display: block;" name="id"
                                       class="bid2" value=""></td>
                            <td><input type="text" name="xuhao" readonly class="xuhao2" value="1"></td>
                            <td><input type="text" name="type" class="type2" list="tongchou4">
                                <datalist id="tongchou4">
                                    <option value="机动车损失服务">机动车损失服务</option>
                                    <option value="机动车第三者责任服务">机动车第三者责任服务</option>
                                    <option value="机动车全车盗抢服务">机动车全车盗抢服务</option>
                                    <option value="自燃损失服务">自燃损失服务</option>
                                    <option value="发动机涉水损失服务">发动机涉水损失服务</option>
                                    <option value="指定修理厂服务">指定修理厂服务</option>
                                    <option value="车上货物责任服务">车上货物责任服务</option>
                                    <option value="玻璃单独破碎服务">玻璃单独破碎服务</option>
                                </datalist>
                            </td>
                            <td><input type="text" name="name" class="name2"></td>
                            <td><input type="text" name="fangan" class="fangan2" list="sancais">
                                <datalist id="sancais">
                                    <option value="4S店维修">4S店维修</option>
                                    <option value="一类修理厂">一类修理厂</option>
                                    <option value="二类修理厂">二类修理厂</option>
                                    <option value="三类修理厂">三类修理厂</option>
                                </datalist>
                            </td>
                            <td><input type="text" name="price" class="price2" oninput="v26()"></td>
                            <td><input type="text" name="num" class="num2" oninput="v26()"></td>
                            <td><input type="text" name="money" class="money2" oninput="v26()"></td>
                            <!-- <td><input type="text" name="zhekou" class="zhekou2" value="100" oninput="v26()"></td> -->
                            <td><input readonly type="text" name="price_he" class="price_he2" oninput="v26()"></td>
                            <td><input readonly type="text" name="num_he" class="num_he2" oninput="v26()"></td>
                            <td><input readonly type="text" name="hejia" class="hejia2" oninput="v26()"></td>
                            <td><input type="text" name="beizhu" class="beizhu2"></td>
                        </tr>
                    </table>
                    <table class="layui-table" id="he4">
                        <tr>
                            <td>小计</td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" id="c_money" name="c_money"></td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" id="c_hejia" name="c_hejia"></td>
                            <td><input type="text" readonly></td>

                        </tr>
                    </table>
                    <script>
                        function v26() {
                            var price = $('.price2');
                            var num = $('.num2');
                            var moneys = $('.money2');
                            /*var zhekous = $('.zhekou2');*/
                            var price_hes = $('.price_he2');
                            var num_hes = $('.num_he2');
                            var hejias = $('.hejia2');

                            var money1 = new Array();
                            for (var i = 0; i < price.length; i++) {
                                money1[i] = price[i].value * num[i].value;
                                moneys[i].value = money1[i];
                                hejias[i].value = (price_hes[i].value * num_hes[i].value).toFixed(2);
                            }
                            var money = new Array();
                            var result = 0;
                            for (var i = 0; i < moneys.length; i++) {
                                money[i] = parseFloat(moneys[i].value);
                                result += money[i];
                            }
                            var benche_money = document.getElementById('c_money');
                            var c_heji = document.getElementById('c_heji');
                            if (result > 0) {
                                benche_money.value = result.toFixed(2);
                                c_heji.value = result.toFixed(2);
                            }

                            var hejia = new Array();
                            var results = 0;
                            for (var i = 0; i < hejias.length; i++) {
                                hejia[i] = parseFloat(hejias[i].value);
                                results += hejia[i];
                            }
                            var benche_hejia = document.getElementById('c_hejia');
                            var benche_heji = document.getElementById('c_heji');
                            if (results > 0) {
                                benche_hejia.value = results.toFixed(2);
                                benche_heji.value = results.toFixed(2);
                            }

                            var sancai_heji = document.getElementById('c_heji').value;
                            var sancai_canzhi = document.getElementById('c_canzhi').value;
                            var sancai_zongji = document.getElementById('c_zongji');
                            var number = (Number(sancai_heji) - Number(sancai_canzhi)).toFixed(2);
                            sancai_zongji.value = number;
                        }
                    </script>
                    <!--<p>汇总</p>-->
                    <div class="conts">
                        <div class="input">
                            <span>合计</span>
                            <input type="text" readonly placeholder="合计" id="c_heji" name="c_heji">
                        </div>
                        <div class="input">
                            <span>残值</span>
                            <input type="text" readonly value="0" placeholder="残值" id="c_canzhi" oninput="v26()"
                                   name="c_canzhi">
                        </div>
                        <div class="input">
                            <span>财物总计</span>
                            <input type="text" readonly placeholder="财物总计" id="c_zongji" name="c_zongji">
                        </div>
                    </div>
                    <div class="conts">
                        <div class="input dong">
                            <span>诉讼费</span>
                            <input type="text" placeholder="诉讼费" id="sancai_susong" name="sancai_susong"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>鉴定费</span>
                            <input type="text" placeholder="鉴定费" id="sancai_jianding" name="sancai_jianding"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>公估费</span>
                            <input type="text" placeholder="公估费" id="sancai_gonggu" name="sancai_gonggu"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>住宿费</span>
                            <input type="text" placeholder="住宿费" id="sancai_zhusu" name="sancai_zhusu"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>路桥费</span>
                            <input type="text" placeholder="路桥费" id="sancai_luqiao" name="sancai_luqiao"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>燃油费</span>
                            <input type="text" placeholder="燃油费" id="sancai_ranyou" name="sancai_ranyou"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>其他</span>
                            <input type="text" placeholder="其他" id="sancai_qita" name="sancai_qita" oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>汇总</span>
                            <input type="text" placeholder="汇总" id="sancai_huizong" name="sancai_huizong">
                        </div>
                    </div>
                    <div class="conts">
                        <div class="input dong">
                            <span>核定诉讼费</span>
                            <input readonly type="text" placeholder="诉讼费" id="hd_sancai_susong"
                                   name="hd_sancai_susong" oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>核定鉴定费</span>
                            <input readonly type="text" placeholder="鉴定费" id="hd_sancai_jianding"
                                   name="hd_sancai_jianding" oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>核定公估费</span>
                            <input readonly type="text" placeholder="公估费" id="hd_sancai_gonggu"
                                   name="hd_sancai_gonggu" oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>核定住宿费</span>
                            <input readonly type="text" placeholder="住宿费" id="hd_sancai_zhusu" name="hd_sancai_zhusu"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>核定路桥费</span>
                            <input readonly type="text" placeholder="路桥费" id="hd_sancai_luqiao"
                                   name="hd_sancai_luqiao" oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>核定燃油费</span>
                            <input readonly type="text" placeholder="燃油费" id="hd_sancai_ranyou"
                                   name="hd_sancai_ranyou" oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>核定其他</span>
                            <input readonly type="text" placeholder="其他" id="hd_sancai_qita" name="hd_sancai_qita"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>核定汇总</span>
                            <input readonly type="text" placeholder="汇总" id="hd_sancai_huizong"
                                   name="hd_sancai_huizong">
                        </div>
                    </div>
                    <script>
                        function vs666() {
                            var sancai_susong = document.getElementById('sancai_susong').value;
                            var sancai_jianding = document.getElementById('sancai_jianding').value;
                            var sancai_gonggu = document.getElementById('sancai_gonggu').value;
                            var sancai_zhusu = document.getElementById('sancai_zhusu').value;
                            var sancai_luqiao = document.getElementById('sancai_luqiao').value;
                            var sancai_ranyou = document.getElementById('sancai_ranyou').value;
                            var sancai_qita = document.getElementById('sancai_qita').value;
                            var sancai_huizong = document.getElementById('sancai_huizong');
                            var number = (Number(sancai_susong) + Number(sancai_jianding) + Number(sancai_gonggu) + Number(sancai_zhusu) + Number(sancai_luqiao) + Number(sancai_ranyou) + Number(sancai_qita)).toFixed(2);
                            if (number != 'NaN') {
                                sancai_huizong.value = number;
                            }
                        }
                    </script>
                    <div class="conts">
                        <span style="width:98%;margin: 1%;">备注说明</span>
                        <textarea id="beizhu666" readonly name="beizhu" cols="30" rows="10"
                                  style="width:98%;height: 100px;margin: 1%;"></textarea>
                    </div>
                    <div class="conts" style="display: flex;justify-content: center;">
                    <div class="">
                        <button type="button" onclick="closeDialoga666()" style="margin: 1%;margin-top:20px;">关闭
                            </button>
                        </div>
                    </div>
                    <!--</div>-->
                </form>
            </div>
        </div>
    </div>
    <div id="fade666" class="black_overlay"></div>
    <script>

        function closeDialoga666() {
            document.getElementById('light666').style.display = 'none';
            document.getElementById('fade666').style.display = 'none';
        }

        function openDialogs666(sub) {
            if (sub.value == "") {
                return;
            }
            var td = sub.parentNode;
            var td1 = td.previousElementSibling.previousElementSibling.firstChild;
            var id = td1.value;
            if (id == '') {
                return false;
            }
            $.ajax({
                url: "{:url('bushen/lisuan/liulan_cai')}",
                data: {id: id},
                type: 'post',
                dataType: 'json',
                success: function (res) {
                    if (res.status == true) {
                        if (res.data.scwusun.status == 0) {
                            $("#sancai_add").show();
                            $("#sancai_del").show();
                            $("#sancai_save").show();
                            $("#sancai_save").show();
                            $("#sancai_save_2").show();
                        } else {
                            $("#sancai_add").hide();
                            $("#sancai_del").hide();
                            $("#sancai_save").hide();
                            $("#sancai_save").hide();
                            $("#sancai_save_2").hide();
                        }
                        $('.bid').val(res.data.scwusun.id);
                        var html3 = '';
                        if (res.data.sancai.length > 0) {
                            for (var i = 0; i < res.data.sancai.length; i++) {
                                html3 += "<tr>" +
                                    "<td><input type='checkbox' style='width: 15px;height: 15px;display: block;' name='id' class='bid2' value=" + res.data.sancai[i].id + "></td>" +
                                    "<td><input type='text' name='xuhao' readonly class='xuhao2' value=" + res.data.sancai[i].xuhao + "></td>" +
                                    "<td><input type='text' name='type' class='type2' list='tongchou46' value=" + res.data.sancai[i].type + ">" +
                                    "<datalist id='tongchou46'>" +
                                    "<option value='机动车损失服务'>机动车损失服务</option>" +
                                    "<option value='机动车第三者责任服务'>机动车第三者责任服务</option>" +
                                    "<option value='机动车全车盗抢服务'>机动车全车盗抢服务</option>" +
                                    "<option value='自燃损失服务'>自燃损失服务</option>" +
                                    "<option value='发动机涉水损失服务'>发动机涉水损失服务</option>" +
                                    "<option value='指定修理厂服务'>指定修理厂服务</option>" +
                                    "<option value='车上货物责任服务'>车上货物责任服务</option>" +
                                    "<option value='玻璃单独破碎服务'>玻璃单独破碎服务</option>" +
                                    "</datalist></td>" +
                                    "<td><input type='text' name='name' class='name2' value=" + res.data.sancai[i].name + "></td>" +
                                    "<td><input type='text' name='fangan' class='fangan2' list='sancais' value=" + res.data.sancai[i].fangan + ">" +
                                    "<datalist id='sancais'>" +
                                    "<option value='4S店维修'>4S店维修</option>" +
                                    "<option value='一类修理厂'>一类修理厂</option>" +
                                    "<option value='二类修理厂'>二类修理厂</option>" +
                                    "<option value='三类修理厂'>三类修理厂</option>" +
                                    "</datalist></td>" +
                                    "<td><input type='text' name='price' class='price2' oninput='v26()' value=" + res.data.sancai[i].price + "></td>" +
                                    "<td><input type='text' name='num' class='num2' oninput='v26()' value=" + res.data.sancai[i].num + "></td>" +
                                    "<td><input type='text' name='money' class='money2' oninput='v26()' value=" + res.data.sancai[i].money + "></td>" +
                                    /* "<td><input type='text' name='zhekou' class='zhekou2' oninput='v26()' value=" + res.data.sancai[i].zhekou + "></td>" +*/
                                    "<td><input type='text' readonly  name='price_he' class='price_he2' oninput='v26()' value=" + res.data.sancai[i].price_he + "></td>" +
                                    "<td><input type='text' readonly name='num_he' class='num_he2' oninput='v26()' value=" + res.data.sancai[i].num_he + "></td>" +
                                    "<td><input type='text' readonly name='hejia' class='hejia2' oninput='v26()' value=" + res.data.sancai[i].hejia + "></td>" +
                                    "<td><input type='text' name='beizhu' class='beizhu2' value=" + res.data.sancai[i].beizhu + "></td>" +
                                    "</tr>";
                            }
                        } else {
                            html3 += "<tr>" +
                                "<td><input type='checkbox' style='width: 15px;height: 15px;display: block;' name='id' class='bid2' value=''></td>" +
                                "<td><input type='text' name='xuhao' value='1' readonly class='xuhao2'></td>" +
                                "<td><input type='text' name='type' class='type2' list='tongchou46'>" +
                                "<datalist id='tongchou46'>" +
                                "<option value='机动车损失服务'>机动车损失服务</option>" +
                                "<option value='机动车第三者责任服务'>机动车第三者责任服务</option>" +
                                "<option value='机动车全车盗抢服务'>机动车全车盗抢服务</option>" +
                                "<option value='自燃损失服务'>自燃损失服务</option>" +
                                "<option value='发动机涉水损失服务'>发动机涉水损失服务</option>" +
                                "<option value='指定修理厂服务'>指定修理厂服务</option>" +
                                "<option value='车上货物责任服务'>车上货物责任服务</option>" +
                                "<option value='玻璃单独破碎服务'>玻璃单独破碎服务</option>" +
                                "</datalist></td>" +
                                "<td><input type='text' name='name' class='name2'></td>" +
                                "<td><input type='text' name='fangan' class='fangan2' list='sancais'>" +
                                "<datalist id='sancais'>" +
                                "<option value='4S店维修'>4S店维修</option>" +
                                "<option value='一类修理厂'>一类修理厂</option>" +
                                "<option value='二类修理厂'>二类修理厂</option>" +
                                "<option value='三类修理厂'>三类修理厂</option>" +
                                "</datalist></td>" +
                                "<td><input type='text' name='price' class='price2' oninput='v26()'></td>" +
                                "<td><input type='text' name='num' class='num2' oninput='v26()'></td>" +
                                "<td><input type='text' name='money' class='money2' oninput='v26()'></td>" +
                                /*"<td><input type='text' name='zhekou' class='zhekou2' value='100' oninput='v26()'></td>" +*/
                                "<td><input type='text' readonly name='price_he' class='price_he2' oninput='v26()'></td>" +
                                "<td><input type='text' readonly name='num_he' class='num_he2' oninput='v26()'></td>" +
                                "<td><input type='text' readonly name='hejia' class='hejia2' oninput='v26()'></td>" +
                                "<td><input type='text' name='beizhu' class='beizhu2'></td>" +
                                "</tr>";
                        }
                        $("#tabProduct46 tr").slice(1).remove();
                        $('#tabProduct46').append(html3);
                        $('#c_money').val(res.data.scwusun.c_money);
                        $('#c_hejia').val(res.data.scwusun.c_hejia);
                        $('#c_heji').val(res.data.scwusun.c_heji);
                        $('#c_canzhi').val(res.data.scwusun.c_canzhi);
                        $('#c_zongji').val(res.data.scwusun.c_zongji);
                        $('#sancai_susong').val(res.data.scwusun.sancai_susong);
                        $('#sancai_jianding').val(res.data.scwusun.sancai_jianding);
                        $('#sancai_gonggu').val(res.data.scwusun.sancai_gonggu);
                        $('#sancai_zhusu').val(res.data.scwusun.sancai_zhusu);
                        $('#sancai_luqiao').val(res.data.scwusun.sancai_luqiao);
                        $('#sancai_ranyou').val(res.data.scwusun.sancai_ranyou);
                        $('#sancai_qita').val(res.data.scwusun.sancai_qita);
                        $('#sancai_huizong').val(res.data.scwusun.sancai_huizong);
                        $('#beizhu666').val(res.data.scwusun.beizhu);
                        //
                        v26();
                        $('#hd_sancai_susong').val(res.data.scwusun.hd_susong_fee);
                        $('#hd_sancai_jianding').val(res.data.scwusun.hd_jianding_fee);
                        $('#hd_sancai_gonggu').val(res.data.scwusun.hd_gonggu_fee);
                        $('#hd_sancai_zhusu').val(res.data.scwusun.hd_zhusu_fee);
                        $('#hd_sancai_luqiao').val(res.data.scwusun.hd_luqiao_fee);
                        $('#hd_sancai_ranyou').val(res.data.scwusun.hd_ranyou_fee);
                        $('#hd_sancai_qita').val(res.data.scwusun.hd_qita_fee);
                        $('#hd_sancai_huizong').val(Number(res.data.scwusun.hd_qita_fee)
                            + Number(res.data.scwusun.hd_susong_fee)
                            + Number(res.data.scwusun.hd_jianding_fee)
                            + Number(res.data.scwusun.hd_gonggu_fee)
                            + Number(res.data.scwusun.hd_zhusu_fee)
                            + Number(res.data.scwusun.hd_luqiao_fee)
                            + Number(res.data.scwusun.hd_ranyou_fee)
                        );
                    }
                }
            })

            document.getElementById('light666').style.display = 'block';
            document.getElementById('fade666').style.display = 'block'
        }

        function test666() {
            var div1 = $('#div6');
            if (div1.css('display') === 'block') {
                div1.hide();  // 相当于 display: none
            } else {
                div1.show();  // 相当于 display: block
            }
        }
    </script>
    {include file="bushen/jiean/lisuan3" /}
    {include file="bushen/jiean/buchangkuan3" /}
</div>